
#pragma once

#include "TCHAR.H"
#include "Stl/StlVector.h"
#include "HrkObject.h"
#include "HrkSubMesh.h"

#define MAXWEIGHTS_PERVERTEX		8

struct tSkinBone
{
	std::string boneName;
	CHrkNode* pBone;
	GLmat4f	offsetMatrix;
	
	int numSkinVert;
	int* vIndices;
	float* wArrays;
};

struct tSkinVert{
	int b;//bone
	float w;//weight
};

class CHrkModel;

class CHrkMesh:public CHrkObject
{
	DECLARE_DYNCREATE( CHrkMesh ) 
public:
	STLvector<GLvec3f> m_posVec;
	STLvector<GLvec3f> m_normalVec;
	STLvector<GLvec2f> m_tcVec;
	STLvector<GLvec4f> m_vcVec;

	STLvector<GLmat4f> m_weightVec;
	STLvector<GLmat4f> m_boneIndexVec;

	STLvector<tSkinBone> m_skinBonesVec;
	STLvector<CHrkSubMesh*> m_subMeshesVec;
	
	CHrkModel* m_pModel;
public:
	CHrkMesh();
	virtual void UpdateTransform();
	virtual void ParseScript( TiXmlElement* elem );
};